export const mixin = {
    props: ["riverId", "indexName", "indexId"],
    data() {
        return {
            span: 18,
            disabled: true,
            formBak: null
        }
    },
    methods: {
        setDisabled(val) {
            this.disabled = val
        },
        //显示加载中
        changeLoading(val) {
            this.$emit("changeLoading", val)
        },
        refreshIndexList() {
            this.$emit("refreshIndexList")
        },
        castValue(value, options) {
            for (let i = 0; i < options.length; i++) {
                if (value === options[i].value) {
                    return options[i].label
                }
            }
        },
        setBakData(isStore, isExpert) {
            if (isStore) {
                this.formBak = isExpert ? { ...this.expertForm } : { ...this.form }
            } else {
                if (isExpert) {
                    Object.keys(this.expertForm).forEach((key) => {
                        this.expertForm[key] = this.formBak[key]
                    })
                } else {
                    Object.keys(this.form).forEach((key) => {
                        this.form[key] = this.formBak[key]
                    })
                }
            }
        },
    },
}